package com.fly.service.Impl;

import com.fly.bean.Task;
import com.fly.bean.Users;
import com.fly.mapper.TaskMapperO;
import com.fly.service.TaskServiceO;
import com.fly.util.Page;
import com.fly.vo.AndPageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: Orchid
 * @Date: 2019/11/27 19:29
 * @Description:
 */
@Service
public class TaskServiceOImpl implements TaskServiceO {

    @Autowired
    TaskMapperO taskMapper;

    @Override
    public List<Task> queryTaskByUsersId(Integer userId, Page page) {

        AndPageVO andPageVO = new AndPageVO(userId, page);

        System.out.println(andPageVO.toString());

        List<Task> taskList = taskMapper.selectTaskByUsersId(andPageVO);

        return taskList;
    }

    @Override
    public Integer queryCountTaskByUserId(Users users) {

        return taskMapper.selectCountTaskByUserId(users);
    }

    @Override
    public Task queryTaskByTaskId(Integer taskId) {

        Task task = taskMapper.selectTaskByTaskId(taskId);

        return task;
    }

    @Override
    public Boolean queryUserRoleIsSuper(Integer userId) {

        Integer count = taskMapper.selectUserRoleIsSuper(userId);

        if (count > 0){
            return true;
        }else {
            return false;
        }

    }

}
